package com.jerei.test;

import java.util.Calendar;
import java.util.concurrent.Future;

/**
 * Created by sunfeihu on 2016/12/14.
 */
public class HelloService {

    public static String sayHello(final String name) throws Exception {
        String str1 = "";
        String str2 = "";
        Future<String> f1 = new SayHelloCommand(name).queue();
        Future<String> f2 = new OtherSayHelloCommmand(name).queue();
        str1 = f1.get();
        str2 = f2.get();
        return str1 + ":" + str2;
    }

    public static void main(String[] args) throws Exception {
        HelloService helloService = new HelloService();
        long start = Calendar.getInstance().getTime().getTime();
        System.out.println(helloService.sayHello("sunfh"));
        long end = Calendar.getInstance().getTime().getTime();
        System.out.println(end - start);
    }

}